<?php

namespace app\admin\model;

use app\common\model\BaseModel;
use think\model\concern\SoftDelete;

class Coupon extends BaseModel
{

    use SoftDelete;

    

    // 表名
    protected $name = 'coupon';
    
    // 自动写入时间戳字段
    protected $autoWriteTimestamp = 'int';

    // 定义时间戳字段名
    protected $createTime = 'createtime';
    protected $updateTime = 'updatetime';
    protected $deleteTime = 'deletetime';

    // 追加属性
    protected $append = [

    ];

    //门槛类型处理
    public static function fetchLimitType($limit_type = null){
        $data =  [
            1 => '天数',
            2 => '金额',
        ];
        if (isset($data[$limit_type])) {
            return $data[$limit_type];
        }else{
            return $data;
        }
    }

    //类型处理
    public static function fetchType($type = null){
        $data =  [
            1 => '优惠券',
            2 => '折扣券',
            3 => '新人优惠券',
        ];
        if (isset($data[$type])) {
            return $data[$type];
        }else{
            return $data;
        }
    }
    





}
